/**
 * 新增list类型数据
 */
Vue.component("new-list", {
    template :
        `
        <div>
            <Input v-for="(v,index) in values" :value="v" type="textarea" :autosize="{minRows: 5, maxRows: 10}" placeholder="请输入..." @on-blur="returnValue"/>
            <Button type="dashed" icon="ios-plus-empty" @click="newLine">
                <span>新增一行...</span>
            </Button>
        </div>
        `
    ,
    props: ["value"],
    data : function () {
        return {
            values : [""]
        };
    },
    methods : {
        returnValue: function (index, value) {
            debugger;
            //alert(this.value);
            console.log(this.values);
            this.$emit("returnValue", this.value);
        },
        newLine : function () {
            this.values.push("");
        }
    },
    watch : {
        value : function (txt) {
            if(txt){
                this.values = JSON.parse(txt);
            }
        }
    }
});